home *** CD-ROM | disk | FTP | other *** search
- /* GNUPLOT - hpgl.trm */
- /*
- * Copyright (C) 1990
- *
- * Permission to use, copy, and distribute this software and its
- * documentation for any purpose with or without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.
- *
- * Permission to modify the software is granted, but not the right to
- * distribute the modified code. Modifications are to be distributed
- * as patches to released version.
- *
- * This software is provided "as is" without express or implied warranty.
- *
- * This file is included by ../term.c.
- *
- * This terminal driver supports:
- * hpgl, hp7580b, HP Laserjet III
- *
- * AUTHORS
- * Colin Kelley, Thomas Williams, Russell Lang
- *
- * send your comments or suggestions to (pixar!info-gnuplot@sun.com).
- *
- */
-
- #define HPGL_XMAX 15200
- #define HPGL_YMAX 10000
-
- #define HPGL_XLAST (HPGL_XMAX - 1)
- #define HPGL_YLAST (HPGL_XMAX - 1)
-
- /* HPGL_VCHAR, HPGL_HCHAR are not used */
- #define HPGL_VCHAR (HPGL_YMAX/100*32/10) /* 3.2% */
- #define HPGL_HCHAR (HPGL_XMAX/100*12/10) /* 1.2% */
- #define HPGL_VTIC (HPGL_YMAX/70)
- #define HPGL_HTIC (HPGL_YMAX/70)
-
- int HPGL_ang = 0;
-
- HPGL_init()
- {
- fputs("\033.Y\n",outfile);
- /* 1
- 1. enable eavesdropping
- */
- }
-
- HPLJIII_PORT_init()
- {
- fputs("\033E\033&l1X\033&l0O\033%0B;PW0.15\n",outfile);
- }
-
- HPLJIII_LAND_init()
- {
- fputs("\033E\033&l1X\033&l1O\033%0B;PW0.15\n",outfile);
- }
-
-
- HPGL_graphics()
- {
- fprintf(outfile,
- "IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
- HPGL_XMAX,HPGL_YMAX,
- ((double)(HPGL_HCHAR)*200/3/HPGL_XMAX),
- ((double)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
- /* 1 2 3
- 1. reset to power-up defaults
- 2. set SCaling
- 3. set character size
- */
- HPGL_ang = 0;
- }
-
-
- HPGL_text()
- {
- fputs("PU;\nSP0;\n\033.Z\0",outfile);
- /* 1 2 3
- 1. pen up
- 2. park pen
- 3. disable eavesdropping
- */
- }
-
-
- HPGL_linetype(linetype)
- int linetype;
- {
- /* allow for 6 pens */
- fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1);
- }
-
-
- HP75_linetype(linetype)
- int linetype;
- {
- /* allow for 4 pens */
- fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1);
- }
-
-
- /* some early HPGL plotters (e.g. HP7220C) require the
- * Pen Up/Down and Pen (move) Absolute commands to be separate
- */
- HPGL_move(x,y)
- int x,y;
- {
- fprintf(outfile,"PU;PA%d,%d;\n",x,y);
- }
-
-
- HPGL_vector(x,y)
- int x,y;
- {
- fprintf(outfile,"PD;PA%d,%d;\n",x,y);
- }
-
-
- HPGL_put_text(x,y,str)
- int x, y;
- char *str;
- {
- if (HPGL_ang == 1)
- HPGL_move(x + HPGL_VCHAR/4,y);
- else
- HPGL_move(x,y - HPGL_VCHAR/4);
- fprintf(outfile,"LB%s\003\n",str);
- }
-
-
- int HPGL_text_angle(ang)
- int ang;
- {
- HPGL_ang = ang;
- if (ang == 1)
- /* vertical */
- fprintf(outfile,"DI0,1;\n");
- else
- /* horizontal */
- fprintf(outfile,"DI1,0;\n");
- return TRUE;
- }
-
-
- HPGL_reset()
- {
- }
-
- HPLJIII_reset()
- {
- fputs("\033E\n",outfile);
- }
-